﻿@model IEnumerable<CustomerManagement.DataAccess.Customer>

<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.Name)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Phone)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Address)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.CustomerType)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Area.District)
        </th>
        <th></th>
    </tr>

    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Phone)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Address)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.CustomerType)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Area.District)
            </td>
            <td>
                <div class="btn-group">
                    <a class="btn btn-mini btn-info" title="Edit" href="/Customer/EditPartial?customerId=@Html.DisplayFor(modelItem => item.ID)" id="btnEdit_@Html.DisplayFor(modelItem => item.ID)">
                        <i class="icon-edit bigger-125"></i>
                    </a>
                    <a class="btn btn-mini btn-yellow" title="Details">
                        <i class="icon-flag bigger-125"></i>
                    </a>
                    @using CustomerManagement.Infrastructure
                    @Ajax.RawActionLink("<i class='icon-trash bigger-125'></i>", "test", "Customer", new { id = item.ID }, new AjaxOptions { HttpMethod = "Post", Confirm = "Are you sure you want to delete this customer?" }, new { @class = "btn btn-mini btn-danger" })
                </div>
            </td>
        </tr>
    }
</table>